Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: set default for large_full_scan_rows to 0 #131040

Merged
merged 1 commit into from
Sep 20, 2024

Conversation

michae2
Copy link
Collaborator

@michae2 michae2 commented Sep 19, 2024

In #69371 we set the default for large_full_scan_rows to 1000. This default can be surprising for users of disallow_full_table_scans. Now that #122708 is fixed, let's set the default to 0 so that the exemption for small tables is opt-in rather than opt-out.

Fixes: #130726

Release note (sql change): Set the default for session variable large_full_scan_rows to 0. This means that by default, disallow_full_table_scans will disallow all full table scans, even full scans on very small tables. If large_full_scan_rows is set > 0, disallow_full_table_scans will allow full scans estimated to read fewer than large_full_scan_rows.

@michae2 michae2 requested review from a team and mw5h and removed request for a team September 19, 2024 17:53
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@michae2 michae2 requested a review from a team September 19, 2024 17:53
Copy link
Collaborator

@mgartner mgartner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm: Thanks!

Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @michae2 and @mw5h)


-- commits line 14 at r1:
We should probably update the docs here to make it ultra clear what the defaults of large_full_scan_rows are within the description of disallow_full_table_scans and what the implications are when enabling disallow_full_table_scans: that ALL queries with a full table scan will result in an error. cc @taroface I believe those descriptions are owned by the docs team, and not in code, but correct me if I'm wrong.


pkg/sql/exec_util.go line 714 at r1 (raw file):

	"default value for large_full_scan_rows session setting which determines "+
		"the maximum table size allowed for a full scan when disallow_full_table_scans "+
		"is set to true",

nit: add something like this helpful bit from the session setting docs: "To reject all full table or index scans, set to 0."

@taroface
Copy link
Collaborator

taroface commented Sep 19, 2024

:lgtm: Thanks!

Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @michae2 and @mw5h)

-- commits line 14 at r1: We should probably update the docs here to make it ultra clear what the defaults of large_full_scan_rows are within the description of disallow_full_table_scans and what the implications are when enabling disallow_full_table_scans: that ALL queries with a full table scan will result in an error. cc @taroface I believe those descriptions are owned by the docs team, and not in code, but correct me if I'm wrong.

That's correct -- since this PR has a release note, it will generate a corresponding DOC (product change) issue when merged. The doc update will be tracked in that issue.

In cockroachdb#69371 we set the default for `large_full_scan_rows` to 1000. This
default can be surprising for users of `disallow_full_table_scans`. Now
that cockroachdb#122708 is fixed, let's set the default to 0 so that the exemption
for small tables is opt-in rather than opt-out.

Fixes: cockroachdb#130726

Release note (sql change): Set the default for session variable
`large_full_scan_rows` to 0. This means that by default,
`disallow_full_table_scans` will disallow _all_ full table scans, even
full scans on very small tables. If `large_full_scan_rows` is set > 0,
`disallow_full_table_scans` will allow full scans estimated to read
fewer than `large_full_scan_rows`.
Copy link
Collaborator Author

@michae2 michae2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TFTR!

bors r=mgartner

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @mgartner and @mw5h)


-- commits line 14 at r1:

Previously, mgartner (Marcus Gartner) wrote…

We should probably update the docs here to make it ultra clear what the defaults of large_full_scan_rows are within the description of disallow_full_table_scans and what the implications are when enabling disallow_full_table_scans: that ALL queries with a full table scan will result in an error. cc @taroface I believe those descriptions are owned by the docs team, and not in code, but correct me if I'm wrong.

This one is generated, so I went ahead and updated it.


pkg/sql/exec_util.go line 714 at r1 (raw file):

Previously, mgartner (Marcus Gartner) wrote…

nit: add something like this helpful bit from the session setting docs: "To reject all full table or index scans, set to 0."

good call, done

@craig craig bot merged commit 3d2f17c into cockroachdb:master Sep 20, 2024
23 checks passed
@michae2 michae2 deleted the largefullscans branch September 23, 2024 16:55
@mw5h
Copy link
Contributor

mw5h commented Sep 23, 2024

:lgtm:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sql: explore setting default for large_full_scan_rows to 0
5 participants